/*
 * api.js
 * 用户接口
 * date: 2021-07-13
 */
import request from '@/utils/request.js'
// 登录注册
const apiUrl = '/api/blog/'
export const api = {
	// 注册
	reguser: (param = {}, config = {}) => request.post(`${apiUrl}reguser`, param, config),
	// 登录
	login: (param = {}, config = {}) => request.post(`${apiUrl}login`, param, config),
};

// 用户信息
const useUrl = '/my/blog/'
export const use = {
	// 更新用户的基本信息
	get: (param = {}, config = {}) => request.post(`${useUrl}userinfo`, param, config),
	// 更新用户的基本信息
	update: (param = {}, config = {}) => request.post(`${useUrl}userinfo`, param, config),
	// 更新用户的密码
	updatepwd: (param = {}, config = {}) => request.post(`${useUrl}updatepwd`, param, config),
	// 更新用户头像
	avatar: (param = {}, config = {}) => request.post(`${useUrl}update/avatar`, param, config),
	// 关注与取消关注用户
	follow: (param = {}, config = {}) => request.post(`${useUrl}follow`, param, config),
	// 关注列表
	followList: (param = {}, config = {}) => request.post(`${useUrl}followList`, param, config),
	// 粉丝列表
	fansList: (param = {}, config = {}) => request.post(`${useUrl}fansList`, param, config),
}
// 文章信息
const artUrl = '/my/article/'
export const artcle = {
	// 更新文章的基本信息
	update: (param = {}, config = {}) => request.post(`${artUrl}update`, param, config),
	// 获取文章列表信息
	list: (param = {}, config = {}) => request.post(`/api/article/list`, param, config),
	// 获取文章的基本信息
	get: (param = {}, config = {}) => request.post(`/api/article/get`, param, config),
}
// 文件上传信息
const fileUrl = '/api/file/'
export const file = {
	// 更新文件上传的基本信息
	update: (param = {}, config = {}) => request.post(`${fileUrl}update`, param, config),
	// 更新文件上传
	list: (param = {}, config = {}) => request.post(`${fileUrl}list`, param, config),
	// 更新文件删除
	delete: (param = {}, config = {}) => request.post(`${fileUrl}list`, param, config),
}

export default { api, use, artcle, file };